package edu.xpu.cs.hub.mapper;


import edu.xpu.cs.hub.entity.Node;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;


import java.util.Date;
import java.util.List;

@Mapper
@Component
public interface NodeMapper {

    //插入
    @Insert({"insert into nodes (id,name,url,location,date,category) values (#{id},#{name},#{url},#{location},#{date},#{category})"})
    public int insertNodes2sql(@Param("id")String id, @Param("name")String name, @Param("url")String url, @Param("location")String location, @Param("date")Date date,@Param("category")String category);

    //查询
    @Select("select * from nodes")
    public List<Node> selectAllNode();

    @Select("delete from nodes where name = #{name,jdbcType=VARCHAR}")
    public String deleteNodes(String name);

    @Select("select * from nodes where name = #{name,jdbcType=VARCHAR}")
    public List<Node> nodesInfo(String nodeName);
}














